﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using static Unity.Collections.AllocatorManager;

public class Block : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
{
    public GameObject card;
    public GameObject AttackBlock;
    public void OnPointerDown(PointerEventData eventData)
    {
        if (AttackBlock.activeInHierarchy)
        {
            BattleManager.Instance.DestroyArrow();
            BattleManager.Instance.CloseBlocks();
        }
    }
    public void OnPointerEnter(PointerEventData eventData)
    {
        // 当鼠标悬停在该物体上时激活AttackBlock
        if (AttackBlock != null)
        {
            AttackBlock.SetActive(true);
        }
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        // 当鼠标移出该物体范围时禁用AttackBlock
        if (AttackBlock != null)
        {
            AttackBlock.SetActive(false);
        }
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
}
